# DESC: Remove all scripts from input

#read input
N
/<script/ {
	#add \n after script
	s/(<script)/\
\1/
	#and go to script
	t begin_script
    }
    #else print
    p
    #next input line
    d

:begin_script
    /^$/! {
	#print data before <script...
	P
    }
    
:body_script
#in script body search </script>
/<\/script>/ {
	#add \n and "marker"
	s/(<\/script>)/\1SCRIPT_END\
/
	#goto end of script 
	t end_script
    }
    #else (inside script body) read next line
    N
    #and search </script> again
    b body_script
    
:end_script
{
    #remove script body
    s/^.*<\/script>SCRIPT_END//
    #print buffer and go to begin with new line
    D
}